package com.pzh.vue.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pzh.vue.mapper.FileMapper;
import com.pzh.vue.pojo.SysFile;
import com.pzh.vue.service.FileService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class FileServiceImp extends ServiceImpl<FileMapper, SysFile> implements FileService {
    @Resource
    private FileMapper fileMapper;
    @Override
    public void saveFile(SysFile saveFile) {
          save(saveFile);
    }

    @Override
    public SysFile findMd5(String md5) {
        QueryWrapper<SysFile> queryWrapper=new QueryWrapper();
        queryWrapper.eq("md5",md5);
        SysFile file = getOne(queryWrapper);
        return file;
    }

    @Override
    public String findName(String fileUrl) {
        return fileMapper.findName(fileUrl);
    }
}
